/*******************************************************************************
 * Copyright (c) 2008, 2009 Fabio Mauro - Alberto Terraneo.
 * Permission is granted to copy, distribute and/or modify this document
 * under the terms of the GNU Free Documentation License, Version 1.2
 * or any later version published by the Free Software Foundation.
 *     
 * This program is distributed in the hope that it will be useful, 
 * but WITHOUT ANY WARRANTY; without even the implied 
 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
 * See the GNU Free Documentation License for more details.
 *     
 * You should have received a copy of the GNU Free Documentation 
 * License along with this distribution; if not, send a email to authors:
 * aterraneo <at> users.sourceforge.net
 * bigmoby09 <at> users.sourceforge.net
 *******************************************************************************/
package it.blueocean.acanto.model;

import it.blueocean.acanto.model.common.ABaseEntity;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.hibernate.annotations.ForeignKey;

@Entity
@Table(name = "TA_RUOLO")
public class Ruolo extends ABaseEntity implements Serializable
{

	private static final long serialVersionUID = 7738596666353152196L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = "RUOLO_ID", unique = true, nullable = false)
	private long id;

	@ManyToOne
	@JoinColumn(name = "ID_FAMIGLIA")
	@ForeignKey(name = "FK_RUOLO_REFERENTE_FAMIGLIA")
	private Famiglia famiglia;

	@OneToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "ID_RUOLO_FORNITORE")
	@ForeignKey(name = "FK_RUOLO_FORNITORE")
	private Fornitore fornitore;

	public Ruolo()
	{

	}

	public long getId()
	{
		return id;
	}

	public void setId(long id)
	{
		this.id = id;
	}

	public Famiglia getFamiglia()
	{
		return famiglia;
	}

	public void setFamiglia(Famiglia famiglia)
	{
		this.famiglia = famiglia;
	}

	public Fornitore getFornitore()
	{
		return fornitore;
	}

	public void setFornitore(Fornitore fornitore)
	{
		this.fornitore = fornitore;
	}

}
